package leetcode;

/**
 * description:
 * author:张腾
 * date:2021-06-15
 */
public class leetcode852_2 {
    public int peakIndexInMountainArray(int[] arr) {
        int result=0;
        int left = 1;
        int right = arr.length-2;
        while (left<=right){
            int mid = left + (right-left)/2;
            if (arr[mid]>arr[mid+1]){
                right = mid-1;
                result = arr[mid];
            }
            else left = mid+1;
        }
        return result;
    }
}
